package com.liy.cloud.common.yy.service.impl;

import com.liy.cloud.common.yy.dao.YyMoneyDetailDao;
import com.liy.cloud.common.yy.entity.YyMoneyDetail;
import com.das.framework.common.utils.Tools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.liy.cloud.common.yy.dao.YyMoneyMainDao;
import com.liy.cloud.common.yy.entity.YyMoneyMain;
import com.liy.cloud.common.yy.service.YyMoneyMainService;
import com.das.framework.common.dao.IBaseDao;
import com.das.framework.common.service.impl.BaseServiceImpl;

import java.util.List;

/**
 * 设备钱箱信息主表 Service接口服务实现
 * @ClassName: YyMoneyMainServiceImpl
 * @Description: 
 * @author libs
 * @date: 2018-08-15 20:22:42
 */
@Service
public class YyMoneyMainServiceImpl extends BaseServiceImpl<YyMoneyMain, String> implements YyMoneyMainService{

  @Autowired
  private YyMoneyMainDao yymoneymainDao;
  @Autowired
  private YyMoneyDetailDao yyMoneyDetailDao;
  
  @Override
  public IBaseDao<YyMoneyMain, String> getDao() {
    return yymoneymainDao;
  }

  @Override
  public void saveMoneyDevice(YyMoneyMain yyMoneyMainEntity, List<YyMoneyDetail> yyMoneyDetailList) throws Exception{

    yymoneymainDao.insertSelective(yyMoneyMainEntity);
    if(!Tools.listIsNullOrEmpty(yyMoneyDetailList)) {
      for(YyMoneyDetail yyMoneyDetailEntity: yyMoneyDetailList) {
        yyMoneyDetailDao.insertSelective(yyMoneyDetailEntity);
      }
    }
  }

  @Override
  public void updateSign(YyMoneyMain yyMoneyMainEntity) {
    yymoneymainDao.updateSign(yyMoneyMainEntity);
  }

}            